﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AAA.TradeLanguage
{
    public class DefaultFunctionMeta : IFunctionMeta
    {
        private Dictionary<string, object> _dicParameter;
        private string _strDisplayName;
        private bool _isActive;
        private string _strErrorMessage;
        private string[] _strInputVariableNames;
        private string[] _strInputVariableDescs;
        private object[] _oDefaultValues;

        public DefaultFunctionMeta()
        {
            _dicParameter = new Dictionary<string, object>();
        }

        #region IFunctionMeta Members

        public bool IsActive
        {
            get { return _isActive; }
            set { _isActive = value; }
        }

        public string ErrorMessage
        {
            get { return _strErrorMessage; }
            set { _strErrorMessage = value; }
        }

        public string DisplayName
        {
            get { return _strDisplayName; }
            set { _strDisplayName = value; }
        }

        public string[] InputVariableNames
        {
            get { return _strInputVariableNames; }
            set { _strInputVariableNames = value; }
        }

        public string[] InputVariableDescs
        {
            get { return _strInputVariableDescs; }
            set { _strInputVariableDescs = value; }
        }

        public object[] DefaultValues
        {
            get { return _oDefaultValues; }
            set { _oDefaultValues = value; }
        }

        public void InputVariable(string strName, object oValue)
        {
            if (_dicParameter.ContainsKey(strName))
                _dicParameter[strName] = oValue;
            else
                _dicParameter.Add(strName, oValue);
        }

        public object InputVariable(string strName)
        {
            return _dicParameter.ContainsKey(strName)
                        ? _dicParameter[strName]
                        : null;
        }

        #endregion
    }
}
